Skip to content

Switch to pathlib to fix Win compatibility#20

Merged
Xarthisius merged 1 commit intomainfrom
windows_fix
Mar 16, 2026
Merged

Switch to pathlib to fix Win compatibility#20
Xarthisius merged 1 commit intomainfrom
windows_fix

Conversation

@Xarthisius
Copy link
Contributor

This pull request refactors the codebase to replace usage of the os module with the pathlib module for file and path operations, enhancing cross-platform compatibility and code readability. It also improves path handling logic in several places, especially for subpath filtering and file verification. Additionally, some minor variable adjustments and ordering fixes are included.

Migration from os to pathlib for file and path operations:

  • All file and directory checks, path manipulations, and file existence tests in tro_utils/cli.py and tro_utils/tro_utils.py now use pathlib instead of os, improving cross-platform robustness and code clarity. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] Fcb9268dL321R322)

Improvements to path handling logic:

  • Subpath filtering in verify_replication_package now uses pathlib.PurePosixPath.relative_to for robust and accurate filtering, preventing errors with path substring logic.
  • The base_filename property and related filename manipulations now use pathlib for resolving absolute paths.

Bug fixes and minor adjustments:

  • The ordering of return values in verify_replication_package was corrected to match expected output. [1] [2]
  • The default value for subpath in verify_package was changed from an empty string to None for clarity and correctness.
  • Status assignment in generate_report was simplified for readability.

@Xarthisius Xarthisius merged commit e1b700f into main Mar 16, 2026
6 checks passed
@Xarthisius Xarthisius deleted the windows_fix branch March 16, 2026 20:08
@codecov
Copy link

codecov bot commented Mar 16, 2026

Codecov Report

❌ Patch coverage is 93.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.61%. Comparing base (00c76f5) to head (94cdf05).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
tro_utils/tro_utils.py 91.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #20      +/-   ##
==========================================
+ Coverage   91.50%   91.61%   +0.11%     
==========================================
  Files           3        3              
  Lines         506      513       +7     
==========================================
+ Hits          463      470       +7     
  Misses         43       43              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant